<extend name="Public/base" />
<block name="body">
<div class="main-title">
    <h2>用户组授权</h2>
</div>
    
<div class="panel panel-default">
    <div class="panel-body">    
        <div class="row">
            <div class="col-lg-6" id="auth_groups">
                <form  action="{:U('addToGroup')}" method="post" enctype="application/x-www-form-urlencoded" class="form" role="form" >
                    <label class="item-label">{$nickname}  所属的用户组列表</label>
                    <volist name="auth_groups" id="vo">
                    <label class="checkbox" class="form-control">
                        <input class="auth_groups" type="checkbox" name="group_id[]" value="{$vo.id}">{$vo.title}
                    </label>
                    </volist>
                    <input type="hidden" name="uid" value="{:I('uid')}">
                    <input type="hidden" name="batch" value="true">
                    <div class="form-group">
                        <button type="submit" class="btn btn-default submit-btn ajax-post" target-form="form">确 定</button>
                        <button class="btn btn-default btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</block>

<block name="script">
<script type="text/javascript">
$(function(){
    var group = [{$user_groups}];
    $('.auth_groups').each(function(){
        if( $.inArray( parseInt(this.value,10),group )>-1 ){
            $(this).prop('checked',true);
        }
    });
});
    
//导航高亮
highlight_subnav('{:U('AuthManager/Group')}');
</script>
</block>
